package entity

import (
	"time"
)

type AlarmInfo struct {
	ID         string      `gorm:"column:id;primaryKey"`    //主键ID
	Type       AlarmType   `gorm:"column:type;type:enum"`   //告警类型
	Detail     string      `gorm:"column:detail"`           //告警详情
	HostIP     string      `gorm:"column:host_ip"`          //主机IP
	DeviceCode string      `gorm:"column:device_code"`      //设备编号
	ResourceId string      `gorm:"column:resource_id"`      //资源ID 接口唯一标识（如URL）
	Flag       DeviceType  `gorm:"column:flag"`             //标记 1服务器 2交换机 3PDU 4 播控器,9NTP, 51WiFi，52车地无线 53车地无线转储 54编播设备 99网络设备
	Status     AlarmActive `gorm:"column:status;type:enum"` //告警状态（0关闭 1激活）
	LevelID    int         `gorm:"column:level_id"`         //告警等级
	CreatorID  int64       `gorm:"column:creator_id"`       //创建人ID
	Creator    string      `gorm:"column:creator"`          //创建人
	CreateTime time.Time   `gorm:"column:create_time"`      //创建时间
	ModifyID   int64       `gorm:"column:modify_id"`        //修改人ID
	Modifier   string      `gorm:"column:modifier"`         //修改人
	ModifyTime time.Time   `gorm:"column:modify_time"`      //修改时间
}

type AlarmType int

const (
	NETWORK_ERROR                  AlarmType = 100 //设备失联
	CPU_ERROR                      AlarmType = 200 //CPU异常
	DISK_ERROR                     AlarmType = 201 //磁盘异常
	MEMORY_ERROR                   AlarmType = 202 //内存异常
	WATCH_DOG_ERROR                AlarmType = 300 //看门狗异常
	NTP_ERROR                      AlarmType = 301 //NTP异常
	DATABASE_ERROR                 AlarmType = 302 //数据库异常
	PLAY_ERROR                     AlarmType = 303 //监播功能异常
	REDIS_ERROR                    AlarmType = 304 //redis异常
	INTERFACE_ERROR                AlarmType = 305 //接口异常
	LCD_ERROR                      AlarmType = 400 //LCD异常
	LED_ERROR                      AlarmType = 401 //LED异常
	SWITCH_ERROR                   AlarmType = 402 //交换机异常
	DATA_DEVICE_ERROR              AlarmType = 403 //存储机异常
	PDU_ERROR                      AlarmType = 404 //PDU异常
	BROADCAST_ERROR                AlarmType = 405 //编播设备异常
	WORKSTATION_ERROR              AlarmType = 406 //工作站异常
	WIFI_ERROR                     AlarmType = 407 //WiFi异常
	VEHICLE_GROUND_RADIO_ERROR     AlarmType = 408 //车地无线异常
	VEHICLE_DUMP_RADIO_ERROR       AlarmType = 409 //车地无线转储异常
	CAR_FIRE_ERROR                 AlarmType = 500 //车厢火灾异常
	CAR_DOOR_ERROR                 AlarmType = 501 //车厢门异常
	DOOR_EMERGENCY_BRAKE_ACTIVATED AlarmType = 502 //车厢门紧急制动触动
)

type AlarmActive int

const (
	INACTIVE AlarmActive = iota
	ACTIVE
)
